<?php


namespace App\Crontab;

use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Crontab\Annotation\Crontab;
use Hyperf\Di\Annotation\Inject;
use Hyperf\DbConnection\Db;
use Hyperf\Logger\LoggerFactory;


/**
 * @Crontab(name="reset_sign", rule="0 0 * * 1", callback="execute", memo="周一00:00定时重置签到记录")
 */
class ResetSignData
{
    private $logger;

    public function __construct(LoggerFactory $loggerFactory)
    {
        $this->logger = $loggerFactory->get('log', 'default');
    }

    public function execute()
    {
        // 返回受影响的行数
        $affected = Db::update("update mj_sign_log set num = 0, sign_data=?,sign_period_data=?", ['', '']);
        ddTitle('affected : ' . $affected);
        $this->logger->warning('affected : ' . $affected);
//        $this->logger->warning('test_mj 定时重置签到记录:reset_sign');
    }

}